﻿var dictitemedit = {
    formDefine: {
        labelWidth: 60, inputWidth: 240, space: 10, labelAlign: 'right',
        fields: [
                    { display: lang.element_name + "：", name: "ITEMNAME", type: "text", newline: true, width: 275 },
                    { display: lang.enname + "：", name: "ITEMDESC", type: "text", newline: true, width: 275 },
                    { display: lang.element_value + "：", name: "ITEMVALUE", type: "text", newline: true, width: 275 },
                    { display: lang.sequence + "：", name: "ITEMORDER", type: "text", newline: true, width: 275 },
//                    { display: lang.Remarks+"：", name: "ITEMDESC", type: "textarea", newline: true, width: 280 },
                    {display: lang.save, name: "search", type: "button", newline: true, nlstyle: "text-align:center", width: 275, click: function () { dictitemedit.form.submit(); } },
                    { display: lang.close, name: "close", type: "button", width: 275, click: function () {
                        parent.$.closePage();
                    }
                    }
                ],
        submitUrl: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
        submitUrlType: "EditDictItem",
        submitCheck: function (params) {
            if (!params["ITEMNAME"] || params["ITEMNAME"] == "") {
                return lang.element_name_can_not_be_empty;
            }
            if (!params["ITEMDESC"] || params["ITEMDESC"] == "") {
                return lang.element_enname_can_not_be_empty;
            }
            if (!params["ITEMVALUE"] || params["ITEMVALUE"] == "") {
                return lang.element_value_can_not_be_empty;
            }
            if (!params["ITEMORDER"] || params["ITEMORDER"] == "") {
                return lang.sequence_cannot_be_empty;
            }
            return "";
        },
        submitParams: function (params) {
            params.DICTTYPE_ID = $.getPara('dicttypeid');
            params.action = 2;
            return params;
        },
        submitSuccess: function () {
            $.alert(lang.add_new_element_success, null, function () { parent.dictitemlist.search(); parent.$.closePage(); });
        }
    },
    init: function () {
        jsPageRender(this);
    }
};